home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 3 / BBS in a box - Trilogy III.iso / Files / Prog / B-C / C++ FAQ Reference 1.0 / C++ FAQ Reference 1.0.rsrc / TEXT_732.txt < prev    next >
Encoding:
Text File  |  1993-06-30  |  424 b   |  9 lines

  1. Use new[] and delete[]:
  2.  
  3.     Thing* p = new Thing[100];
  4.     //...
  5.     delete [] p;    //older compilers require you to use 'delete [100] p'
  6.  
  7. Any time you allocate an array of things (ie: any time you use the '[...]' in the 'new' expression) you *!*MUST*!* use the '[]' in the 'delete' statement.
  8.  
  9. The fact that there is no syntactic difference between a ptr to a thing and a ptr to an array of things is an artifact we inherited from C.